package com.qf.exception;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ZhifuException extends Exception {
    private String message;//异常信息
    private int code;//状态码

    public ZhifuException() {
    }

    public ZhifuException(String message, int code) {
        this.message = message;
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
    public Map<String,Object> toMap(){
        Map<String,Object> map=new ConcurrentHashMap<>();
        map.put("code",getCode());
        map.put("errormsg",getMessage());
        return map;
    }
}
